<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>授权</title>
    <#assign base=request.contextPath  />
    <base id="base" href="${base}">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${base}/static/win10/component/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="${base}/static/style/admin.css" media="all">
    <script>
        var base =  "${base}";
    </script>
</head>
<body>
<br>
<form class="layui-form " action="">
    <input  hidden id="userId" value="${user.id}">
    <div class="layui-form-item">
        <label class="layui-form-label">当前角色</label>
        <div class="layui-input-block">
            <input type="text" name="title" readonly value="<#if user.role??>${user.role.roleName} <#else >无 </#if>" autocomplete="off"   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">新角色</label>
        <div class="layui-input-block">
            <select id="roles" lay-filter="aihao">
                <option value="">请选择....</option>
            </select>
        </div>
    </div>

    <div align="center">
        <button type="button" class="layui-btn" id="submit">授权</button>
    </div>
</form>

<script src="${base}/static/win10/component/layui/layui.js?t=1"></script>
<script src="${base}/static/win10/js/jquery-1.8.3.min.js?t=1"></script>
<script>
    layui.use(['form', 'layer'], function() {
        var form = layui.form
                , layer = layui.layer;
        $.ajax({
            type: "GET",
            url: base + "/WeChatUser/role/admin/finRoleAjax",
            success: function (data) {
                if (data.code === 200) {
                    for (var i = 0; i < data.data.length; i++) {
                        var role=data.data[i];
                        $("#roles").append(
                                ' <option value="'+role.id+'">'+role.roleName+'</option>'
                        )
                    }
                    form.render();
                }
            }
        });


    });

</script>
</body>
</html>